package fileby.main;


import com.google.inject.Binder;
import com.google.inject.Module;

import fileby.ctrl.breadcrumbs.BreadCrumbListenerFactory;
import fileby.ctrl.breadcrumbs.IBreadCrumbListenerProvider;
import fileby.ctrl.actions.impl.ActionController;
import fileby.util.IObservable;
import fileby.ctrl.sidebar.ISideBarItemListenerProvider;
import fileby.ctrl.actions.IActionProvider;
import fileby.ctrl.sidebar.SideBarItemListenerFactory;
import fileby.ctrl.tabs.ITabContentListenerProvider;
import fileby.ctrl.tabs.ITabItemListenerProvider;
import fileby.ctrl.tabs.ITabPanelListenerProvider;
import fileby.ctrl.tabs.TabContentListenerFactory;
import fileby.ctrl.tabs.TabItemListenerFactory;
import fileby.ctrl.tabs.TabPanelListenerFactory;
import fileby.ctrl.transferhandlers.ITransferHandlerProvider;
import fileby.ctrl.transferhandlers.impl.TransferHandlerFactory;
import fileby.gui.MainFrame;
import fileby.gui.breadcrumbs.BreadCrumbFactory;
import fileby.gui.breadcrumbs.IBreadCrumbProvider;
import fileby.gui.magicbox.IMagicBoxItemProvider;
import fileby.gui.magicbox.MagicBoxItemFactory;
import fileby.gui.sidebar.ISideBarProvider;
import fileby.gui.sidebar.SideBarFactory;
import fileby.model.IClipboardManager;
import fileby.model.IFavoriteManager;
import fileby.model.IFileManager;
import fileby.model.IMagicBoxManager;
import fileby.model.IModel;
import fileby.model.ISelectionManager;
import fileby.model.ISourceHandler;
import fileby.model.impl.filemanagement.IFileHandler;
import fileby.model.impl.filemanagement.impl.FileHandler;
import fileby.model.impl.Model;
import fileby.model.impl.sources.IFileSourceManager;
import fileby.model.impl.sources.IFileSourceProvider;
import fileby.model.impl.sources.impl.FileSourceFactory;
import fileby.model.impl.sources.impl.FileSourceManager;
import fileby.util.properties.PropertyBundleFactory;
import fileby.util.properties.IPropertyBundleProvider;

import javax.swing.JFrame;

/**
 *
 * @author Ludwig Kjellstrom
 */
public class FilebyModule implements Module {

    @Override
    public void configure(Binder binder) {
        binder.bind(JFrame.class).to(MainFrame.class);

        // Bound to Model
        binder.bind(IModel.class).              to(Model.class).asEagerSingleton();
        binder.bind(IObservable.class).         to(Model.class);
        binder.bind(IClipboardManager.class).   to(Model.class);
        binder.bind(IFavoriteManager.class).    to(Model.class);
        binder.bind(IFileManager.class).        to(Model.class);
        binder.bind(IMagicBoxManager.class).    to(Model.class);
        binder.bind(ISelectionManager.class).   to(Model.class);
        binder.bind(ISourceHandler.class).      to(Model.class);

        binder.bind(IFileHandler.class).to(FileHandler.class);
        binder.bind(IFileSourceManager.class).to(FileSourceManager.class);

        //Providers to Factories
        binder.bind(IFileSourceProvider.class).to(FileSourceFactory.class);
        binder.bind(ITabItemListenerProvider.class).to(TabItemListenerFactory.class);
        binder.bind(IMagicBoxItemProvider.class).to(MagicBoxItemFactory.class);
        binder.bind(ISideBarItemListenerProvider.class).to(SideBarItemListenerFactory.class);
        binder.bind(ITransferHandlerProvider.class).to(TransferHandlerFactory.class);
        binder.bind(IBreadCrumbProvider.class).to(BreadCrumbFactory.class);
        binder.bind(ISideBarProvider.class).to(SideBarFactory.class);
        binder.bind(IBreadCrumbListenerProvider.class).to(BreadCrumbListenerFactory.class);
        binder.bind(ITabPanelListenerProvider.class).to(TabPanelListenerFactory.class);
        binder.bind(ITabContentListenerProvider.class).to(TabContentListenerFactory.class);
        binder.bind(IPropertyBundleProvider.class).to(PropertyBundleFactory.class);
        binder.bind(IActionProvider.class).to(ActionController.class);

    }
}
